package com.flyduck.vueshop.product.h5.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.flyduck.vueshop.common.core.lang.Result;
import com.flyduck.vueshop.common.mybatis.base.BaseController;
import com.flyduck.vueshop.product.h5.service.H5ProductService;
import com.flyduck.vueshop.product.h5.vo.H5ProductDetailsRespVO;
import com.flyduck.vueshop.product.h5.vo.H5ProductQueryReqVO;
import com.flyduck.vueshop.product.h5.vo.H5ProductRespVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @program: vueshop
 * @description:
 * @author: flyduck
 * @create: 2024-05-18 21:42
 **/
@RestController
@RequestMapping("/product/h5/product")
public class H5ProductController extends BaseController {

    @Resource
    private H5ProductService h5ProductService;

    @GetMapping("/getProductPage")
    public Result<Page<H5ProductRespVO>> getProductPage(H5ProductQueryReqVO h5ProductQueryReqVO){
        Page<H5ProductRespVO> appProductRespVOPage = h5ProductService.getProductPage(getPage(), h5ProductQueryReqVO);
        return Result.success(appProductRespVOPage);
    }

    @GetMapping("/getProductDetailsById/{id}")
    public Result<H5ProductDetailsRespVO> getProductDetailsById(@PathVariable("id") Long id){
        H5ProductDetailsRespVO h5ProductDetailsRespVO =  h5ProductService.getProductDetailsById(id);
        return Result.success(h5ProductDetailsRespVO);
    }
}
